A well system (e.g., an oil or gas well) can be drilled for extracting hydrocarbons from a subterranean formation. During the lifecycle of the well system, it can be desirable to pierce a material (e.g., rock, concrete, debris) in the well system, or extract the material from the well system. This can be achieved through the controlled use of explosives. Explosives can be positioned near the material and detonated to pierce the material or remove the material from the well system. A firing switch can be coupled to the explosives and used to detonate the explosives. Firing switches can become unreliable when exposed to high or fluctuating environmental temperatures, pressures, or levels of ambient light.